How Do I Set the Baud-Rate for the Full UART Soft IP Module?

The FastChip development system includes a library of commonly used peripherals.  One of the more popular is the Full UART with Modem Control module.  The full UART provides full duplex (receive/transmit) communication and has a software-programmable baud rate.

One common question is how to set up the UART’s baud-rate generator.  The baud is determined by a few factors including …

·   the bus clock operating frequency, FBUSCLK

·   the desired baud rate, BAUD

·   the baud-rate generator divisor value, DIVISOR

·   the acceptable baud-rate error, %ERROR

Calculate appropriate DIVISOR value using the following equation.  In most cases, you need to round the result up or down to the closest integer.

 

Creating a low baud rate with a high-speed bus clock frequency may result in a DIVISOR value larger than 256.  The full UART baud-rate generator has an 8-bit divider.  Try the value 256 to see if the actual baud rate is within acceptable error limits.

The actual baud rate generated using the DIVISOR value may be different than the desired baud rate, because DIVISOR must be rounded to the nearest integer value.

The operating frequency and the integer value for DIVISOR may not provide the precise desired baud rate.  Because each bit of the UART is oversampled 16 times and each data transaction re-synchronized, the UART can tolerate slight errors in the baud rate, safely up to 3%.  Calculate the percent baud-rate error using the following equation.

 

Example:

What is the full UART baud-rate DIVISOR value if the desired baud rate is 18,800 bps and the bus clock operating frequency is 33 MHz?

Using the equations above, the DIVISOR = 109.7074, but is rounded to the next closest integer, 110.

Using a DIVISOR of 110 results in an actual baud-rate of 18,750 bits per second, which is different than our desired baud rate of 18,800 bits per second.

However, the error is just 0.27% off the desired baud rate, which is well within the acceptable limit of 3%.

The following steps create a new full UART module and specify the initial DIVISOR value.

 From the FastChip Module Library, double-click the Full UART with Modem Control module icon to open the module.

 Click the Properties tab.

 Enter the Initial divisor value using the value calculated above.  This is the baud rate used when the Triscend device is first configured.  The application program can change this value later by modifying the <name>_baud_sel register within the UART.

 

If changing the baud rate under program control, write
DIVISOR-1 to the <name>_baud_sel register.  In this example, DIVISOR is set to 110 via the FastChip module graphical interface.  If the processor reads the <name>_baud_sel register, the value will be 109.

By default, the internal baud-rate divider is 8 bits wide.  You can conserve some resources by reducing the size.  However, it must be possible to represent the DIVISOR value in the maximum bit width.

 

FastChip Version: 2.2.0

This solution may or may not apply to other versions of the FastChip development system.

 

®

© 2001 by Triscend Corporation.  All rights reserved.